package cz.myslivec.knihovna.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="PUBLISHER")
//@SequenceGenerator(name="PUBLISHER_SEQ", sequenceName="PUBLISHER_SEQ", allocationSize = 1)
public class Publisher implements Serializable {
	private static final long serialVersionUID = -4949634371643495457L;
	
	@Id
	@Column(name = "PUB_ID")
	@GeneratedValue(strategy=GenerationType.AUTO)
	private long id;

	private String name;
	
	private String address;

	// GET & SET
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public long getId() {
		return id;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (id ^ (id >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Publisher other = (Publisher) obj;
		if (id != other.id)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Publisher [id=" + id + ", name=" + name + ", address="
				+ address + "]";
	}
	
}
